package com.hnx.admin.aurora.system.mapper.user;


import com.hnx.admin.aurora.annotation.AddInfo;
import com.hnx.admin.aurora.annotation.UpdateInfo;
import com.hnx.admin.aurora.system.domain.dto.user.entity.UserDTO;
import com.hnx.admin.aurora.system.domain.param.role.query.UserRoleQuery;
import com.hnx.admin.aurora.system.domain.param.user.form.*;
import com.hnx.admin.aurora.system.domain.param.user.query.UserQuery;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Optional;

public interface UserMapper {
    Optional<UserDTO> selectUserByUsername(String username);

    List<UserDTO> getUserList(UserQuery userParam);
    Optional<UserDTO> selectUserById(String userId);
    @UpdateInfo
    int updateUser(UserForm user);
    @UpdateInfo
    @Update("update sys_user set status=#{status} where user_id=#{userId}")
    int updateUserStatus(UserForm user);

    int deleteUserByIds(UserDelForm user);
    @UpdateInfo
    @Update("update sys_user set password=#{password} where user_id=#{userId}")
    int updateUserPassword(UserForm user);
    @AddInfo
    int insertUser(UserForm user);

    List<UserDTO> selectAllocatedList(UserRoleQuery user);

    List<UserDTO> selectUnallocatedList(UserRoleQuery user);
}
